<table class="layui-table">

  <? $task_list =select_lines_all_items($table_Prefix."task","nid desc","case_id ='".$_REQUEST['nid']."' AND (is_del = '0') ","") ;?>

  <colgroup>
        <col width="60">
        <col width="280">
        <col width="100">
        <col width="100">
        <col width="150">
        <col>
        <col width="80">
        <col width="85">
        <col width="180">
  </colgroup>
  <thead>
    <tr>
      <th>序号</th>
      <th>任务标题</th>
      <th>执行人</th>
      <th>开始时间</th>
      <th>截止时间</th>
      <th>备注</th>
      <th>优先级</th>
      <th>状态</th>
      <th>操作</th>
    </tr>
  </thead>  
  <tbody>

  <?php
	for ($i = 0; $i < count($task_list); $i++) {
    ?>
        <tr id="item<?echo $task_list[$i]['nid']?>" >
        <td><?echo $i+1+$plate['page_list_num']*($nowpageid-1) ?>
        <? //echo count_days(date("Y-m-d"),$task_list[$i]['enddate'])?>
        </td>
        <td><div class="els1"><?php if($task_list[$i]['notice_show'] == 1) {?><i class="notice_icon"></i><?php }?><?echo $task_list[$i]['title']?></div></td>

    <?
        $principal=select_one_line_all_items($table_Prefix."employee","nid = '".$task_list[$i]['principal']."'");
    ?>
    <td><?echo $principal['name'] ?: '无'?></td>

 
    <td><?echo substr($task_list[$i]['startdate'],5,5)?></td>

    <?php 
        //获取当前时间 
        $now      = strtotime("now");
        //获取当前日期
        $now_date = date('Y-m-d');
        //获取任务截止时间
        $end_time = strtotime($task_list[$i]['enddate']);
        //获取任务截止日期
        $end_date = date('Y-m-d',$end_time);
    ?>
    <!-- 超时则改变字体颜色 -->
    <!--//todo 这部分的代码，写得有点恐怖，要优化一下简单易懂，仿照下面status的写法-->
    <td>
        <span class="layui-badge <?php if(($now_date == $end_date) and $task_list[$i]['status'] != "已完成")
            {if($now > $end_time){echo "layui-bg-orange";}}else if(($now > $end_time) and $task_list[$i]['status'] != "已完成")
            {echo "layui-bg-red";}else{echo "layui-bg-green";}?>"  >
            <?echo  str_replace('-', '月', substr($task_list[$i]['enddate'],5,5));?>日
             </span>
           <span class="layui-badge <?php if(($now_date == $end_date) and $task_list[$i]['status'] != "已完成")
            {if($now > $end_time){echo "layui-bg-orange";}}else if(($now > $end_time) and $task_list[$i]['status'] != "已完成")
           {echo "layui-bg-red";}else{echo "layui-bg-green";}?>"  >
            <?php if(number2Chinese_number(date('w',strtotime($task_list[$i]['enddate']))) == "零"){
                echo "星期天";
            }else{
                echo  "星期".number2Chinese_number(date('w', strtotime($task_list[$i]['enddate'])));
            }; ?>
        </span>
    </td>


    <?php
        $note = cleanhtml($task_list[$i]['note']);
    ?>
    <td><div class="els1"><?echo $note?></div></td>
    <td>
        <?if($task_list[$i]['priority']=='普通'){ $priority_color = 'layui-bg-green';}?>
        <?if($task_list[$i]['priority']=='紧急'){ $priority_color = '';}?>
        <span class="layui-badge <?echo $priority_color?>">
        <?echo $task_list[$i]['priority']?>
        </span>
    </td>
    <td>
        <?if($task_list[$i]['status']=='进行中'){ $status_color = 'layui-bg-blue';}?>
        <?if($task_list[$i]['status']=='已完成'){ $status_color = 'layui-bg-green';}?>
        <?if($task_list[$i]['status']=='待审核'){ $status_color = '';}?>
        <?if($task_list[$i]['status']=='未开始'){ $status_color = 'layui-badge-rim';}?>
        <?if($task_list[$i]['status']=='已删除'){ $status_color = 'layui-bg-gray';}?>
        <span class="layui-badge <?echo $status_color?>">
        <?echo $task_list[$i]['status']?>
        </span>
    </td>
    <td>

    <a class="layui-btn  layui-btn-sm" onclick="windowEject('../../task/view/modules/mod-detail-edit.php?sys_part=task&nid=<? echo $task_list[$i]['nid']?>&nowpageid=<? echo $_REQUEST['nowpageid'] ?>')">
        <i class="fa fa-bar-chart-o" aria-hidden="true"></i>信息

        <?php if($task_list[$i]['notice_show'] == 1) {?><i class="notice_icon"></i><?php }?>
    </a>





  </td>
    </tr>
  <?php
}
?>



  </tbody>
</table>
